import javax.naming.InitialContext;
import javax.sql.DataSource;
import java.lang.*;
import java.sql.Connection;

public class Final{

    public static Connection getConnect(String s)
    {
        try
        {
            InitialContext context=new InitialContext();
            DataSource dataSource=(DataSource) context.lookup(s);
            return dataSource.getConnection();
        }
        catch (Exception e)  {System.out.println("connection error!");return null;}
    }

}
